//
//  UIColor+ColorGradient.h
//  CDCWallet_New
//
//  Created by hc-101 on 2018/11/21.
//  Copyright © 2018年 hc-101. All rights reserved.
//

#import <UIKit/UIKit.h>


/**
 颜色渐变方式

 - ColorGradientTypeHorizontal: 水平渐变  【从右往左】
 - ColorGradientTypeVertical: 竖直渐变  【从上到下】
 - ColorGradientTypeDownDiagonal: 向下对角线 【从左下到右上】
 - ColorGradientTypeUpDiagonal: 向下对角线  【从左上到右下】
 */
typedef NS_ENUM(NSInteger, ColorGradientType) {
    ColorGradientTypeHorizontal,
    ColorGradientTypeVertical,
    ColorGradientTypeDownDiagonal,
    ColorGradientTypeUpDiagonal,
};

typedef NS_ENUM (NSUInteger, UIGradientStyle) {
    /**
     *  Returns a gradual blend between colors originating at the leftmost point of an object's frame, and ending at the rightmost point of the object's frame.
     *
     *  @since 1.0
     */
    UIGradientStyleLeftToRight,
    /**
     *  Returns a gradual blend between colors originating at the center of an object's frame, and ending at all edges of the object's frame. NOTE: Supports a Maximum of 2 Colors.
     *
     *  @since 1.0
     */
    UIGradientStyleRadial,
    /**
     *  Returns a gradual blend between colors originating at the topmost point of an object's frame, and ending at the bottommost point of the object's frame.
     *
     *  @since 1.0
     */
    UIGradientStyleTopToBottom
};
@interface UIColor (ColorGradient)
@property (nonatomic, strong) UIImage *gradientImage;
/**
 创建渐变

 @param type 渐变方式
 @param size 渐变范围
 @param colors 颜色数组
 @return 渐变完成的颜色
 */
+ (instancetype)ColorGradientType:(ColorGradientType)type andWithSize:(CGSize)size andWithColors:(NSArray<UIColor *> *)colors;
+ (UIColor *)colorWithGradientStyle:(UIGradientStyle)gradientStyle withFrame:(CGRect)frame andColors:(NSArray *)colors;
@end
